# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-pecl-gmagick
_pkgreal=gmagick
pkgver=2.0.6_rc1
_pkgver=${pkgver/_rc/RC}
pkgrel=1
pkgdesc="PHP 8 bindings to the GraphicsMagick library - PECL"
url="https://pecl.php.net/package/gmagick"
arch="all"
license="PHP-3.01"
depends="php8-common ghostscript-fonts"
makedepends="graphicsmagick-dev libtool php8-dev"
source="php-pecl-$_pkgreal-$_pkgver.tgz::https://pecl.php.net/get/$_pkgreal-$_pkgver.tgz"
builddir="$srcdir/$_pkgreal-$_pkgver"

build() {
	phpize8
	./configure \
		--prefix=/usr \
		--with-php-config=/usr/bin/php-config8
	make
}

check() {
	if [ "$CARCH" = "x86" ]; then
		# https://gitlab.alpinelinux.org/alpine/aports/issues/11011
		rm -f \
			tests/gmagick-107_setimagevirtualpixelmethod.phpt \
			tests/gmagick-116_waveImage_basic.phpt
	fi
	# https://github.com/vitoc/gmagick/issues/53
	rm -f tests/gmagick-056-set_getsamplingfactors.phpt
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_pkgreal" > $_confdir/$_pkgreal.ini
}

sha512sums="c09ad751815d06964f16ab95025badc0711ceaaac0cf79035307aa75f2730b021b070d0e45e549ddd5447de68581ec666a817ec5c05a2a4557d4c1548216714f  php-pecl-gmagick-2.0.6RC1.tgz"
